﻿using CUREBusinessLogicLayer.Harmful;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CURE.Experiment
{
    public partial class ExpResult : System.Web.UI.Page
    {
        #region 变量
        private string action;

        public string Action
        {
            get { return action; }
            set { action = value; }
        }
        private string mid;

        public string Mid
        {
            get { return mid; }
            set { mid = value; }
        }


        private string fid;

        public string Fid
        {
            get { return fid; }
            set { fid = value; }
        }
        private string reason;

        public string Reason
        {
            get { return reason; }
            set { reason = value; }
        }

        private string ledgerid;

        public string Ledgerid
        {
            get { return ledgerid; }
            set { ledgerid = value; }
        }


        private string judgename;//判定名称

        public string Judgename
        {
            get { return judgename; }
            set { judgename = value; }
        }
        private string typeno;//型号

        public string Typeno
        {
            get { return typeno; }
            set { typeno = value; }
        }
        private string mcno;//机台别

        public string Mcno
        {
            get { return mcno; }
            set { mcno = value; }
        }
        private string startbt;//F卡bt号 开始

        public string Startbt
        {
            get { return startbt; }
            set { startbt = value; }
        }
        private string endbt;//F卡bt号 结束

        public string Endbt
        {
            get { return endbt; }
            set { endbt = value; }
        }
        private string num;//发生数量

        public string Num
        {
            get { return num; }
            set { num = value; }
        }
        private string fdate;//F卡生产时间

        public string Fdate
        {
            get { return fdate; }
            set { fdate = value; }
        }
        private string desc;//橡胶外观目视描述

        public string Desc
        {
            get { return desc; }
            set { desc = value; }
        }

        private string rubberput;//材料放置点

        public string Rubberput
        {
            get { return rubberput; }
            set { rubberput = value; }
        }

        private string cont;//内容

        public string Cont
        {
            get { return cont; }
            set { cont = value; }
        }
        private string cate;//精炼不良类别

        public string Cate
        {
            get { return cate; }
            set { cate = value; }
        }
        private string deviceabnormal;//设备异常

        public string Deviceabnormal
        {
            get { return deviceabnormal; }
            set { deviceabnormal = value; }
        }
        private string devicecontent;//设备异常内容

        public string Devicecontent
        {
            get { return devicecontent; }
            set { devicecontent = value; }
        }
        private string skillabnormal;//技能员异常

        public string Skillabnormal
        {
            get { return skillabnormal; }
            set { skillabnormal = value; }
        }
        private string skillcontent;//技能员异常内容

        public string Skillcontent
        {
            get { return skillcontent; }
            set { skillcontent = value; }
        }
        private string lotabnormal;//lot异常

        public string Lotabnormal
        {
            get { return lotabnormal; }
            set { lotabnormal = value; }
        }
        private string lotcontent;//lot异常内容

        public string Lotcontent
        {
            get { return lotcontent; }
            set { lotcontent = value; }
        }
        private string workabnormal;//作业录像异常

        public string Workabnormal
        {
            get { return workabnormal; }
            set { workabnormal = value; }
        }
        private string workcontent;//作业录像异常内容

        public string Workcontent
        {
            get { return workcontent; }
            set { workcontent = value; }
        }
        private string rubberno;//橡胶型号

        public string Rubberno
        {
            get { return rubberno; }
            set { rubberno = value; }
        }
        private string rubberlotno;//橡胶批次

        public string Rubberlotno
        {
            get { return rubberlotno; }
            set { rubberlotno = value; }
        }
        private string rubbernum;//橡胶应保留数

        public string Rubbernum
        {
            get { return rubbernum; }
            set { rubbernum = value; }
        }
        private string rubberrealnum;//橡胶实际保留数

        public string Rubberrealnum
        {
            get { return rubberrealnum; }
            set { rubberrealnum = value; }
        }
        private string elementno;//部材型号

        public string Elementno
        {
            get { return elementno; }
            set { elementno = value; }
        }
        private string elementlotno;//部材批次

        public string Elementlotno
        {
            get { return elementlotno; }
            set { elementlotno = value; }
        }
        private string elementnum;//部材应保留数

        public string Elementnum
        {
            get { return elementnum; }
            set { elementnum = value; }
        }
        private string elementrealnum;//部材实际保留数

        public string Elementrealnum
        {
            get { return elementrealnum; }
            set { elementrealnum = value; }
        }
        private string tireno;//生胎型号

        public string Tireno
        {
            get { return tireno; }
            set { tireno = value; }
        }
        private string tirelotno;//生胎批次

        public string Tirelotno
        {
            get { return tirelotno; }
            set { tirelotno = value; }
        }
        private string tirenum;//生胎应保留数

        public string Tirenum
        {
            get { return tirenum; }
            set { tirenum = value; }
        }
        private string tirerealnum;//生胎实际保留数

        public string Tirerealnum
        {
            get { return tirerealnum; }
            set { tirerealnum = value; }
        }
        private string prono;//制品型号

        public string Prono
        {
            get { return prono; }
            set { prono = value; }
        }
        private string prolotno;//制品批次

        public string Prolotno
        {
            get { return prolotno; }
            set { prolotno = value; }
        }
        private string pronum;//制品应保留数

        public string Pronum
        {
            get { return pronum; }
            set { pronum = value; }
        }
        private string prorealnum;//制品实际保留数

        public string Prorealnum
        {
            get { return prorealnum; }
            set { prorealnum = value; }
        }
        private string remarks;//备注

        public string Remarks
        {
            get { return remarks; }
            set { remarks = value; }
        }

        private string sulspec;

        public string Sulspec
        {
            get { return sulspec; }
            set { sulspec = value; }
        }
        private string sulactual;

        public string Sulactual
        {
            get { return sulactual; }
            set { sulactual = value; }
        }
        private string suljudge;

        public string Suljudge
        {
            get { return suljudge; }
            set { suljudge = value; }
        }
        private string weightspec;

        public string Weightspec
        {
            get { return weightspec; }
            set { weightspec = value; }
        }
        private string weightactual;

        public string Weightactual
        {
            get { return weightactual; }
            set { weightactual = value; }
        }
        private string weightjudge;

        public string Weightjudge
        {
            get { return weightjudge; }
            set { weightjudge = value; }
        }
        private string rpagspec;

        public string Rpagspec
        {
            get { return rpagspec; }
            set { rpagspec = value; }
        }
        private string rpaactual;

        public string Rpaactual
        {
            get { return rpaactual; }
            set { rpaactual = value; }
        }
        private string rpajudge;

        public string Rpajudge
        {
            get { return rpajudge; }
            set { rpajudge = value; }
        }
        private string rpatsspec;

        public string Rpatsspec
        {
            get { return rpatsspec; }
            set { rpatsspec = value; }
        }
        private string rpatsactual;

        public string Rpatsactual
        {
            get { return rpatsactual; }
            set { rpatsactual = value; }
        }
        private string rpatsjudge;

        public string Rpatsjudge
        {
            get { return rpatsjudge; }
            set { rpatsjudge = value; }
        }
        private string bpspec;

        public string Bpspec
        {
            get { return bpspec; }
            set { bpspec = value; }
        }
        private string bpactual;

        public string Bpactual
        {
            get { return bpactual; }
            set { bpactual = value; }
        }
        private string bpjudge;

        public string Bpjudge
        {
            get { return bpjudge; }
            set { bpjudge = value; }
        }
        private string resultremarks;

        public string Resultremarks
        {
            get { return resultremarks; }
            set { resultremarks = value; }
        }

        private string page;

        public string Page1
        {
            get { return page; }
            set { page = value; }
        }

        private string approvalreason;

        public string Approvalreason
        {
            get { return approvalreason; }
            set { approvalreason = value; }
        }
        private string state;

        public string State
        {
            get { return state; }
            set { state = value; }
        }

        #endregion

        private LedgerBll ledgerbll = new LedgerBll();

        protected void Page_Load(object sender, EventArgs e)
        {
            page = Request.QueryString["page"];
            mid = Request.QueryString["id"];
            DataTable dt = Bind();
            if (dt.Rows.Count > 0)
            {
                ledgerid = ColumnChange(dt, "LEDGERID");
                fid = ColumnChange(dt, "FID");
                reason = ColumnChange(dt, "REASON");
                fdate =string.IsNullOrEmpty(ColumnChange(dt, "FDATE"))?"":Convert.ToDateTime(ColumnChange(dt, "FDATE")).ToString("yyyy-MM-dd");
                judgename = ColumnChange(dt, "JUDGENAME");
                typeno = ColumnChange(dt, "EXPTYPE");
                mcno = ColumnChange(dt, "MCNO");
                startbt = ColumnChange(dt, "BTNOSTART");
                endbt = ColumnChange(dt, "BTNOEND");
                num = ColumnChange(dt, "NUM");
                desc = ColumnChange(dt, "DESCRIPTION");
                rubberput = ColumnChange(dt, "PLACE");
                cont = ColumnChange(dt, "CONTENT");
                cate = ColumnChange(dt, "LEDGERCATE");
                deviceabnormal = ColumnChange(dt, "DEVICEABNORMAL");
                devicecontent = ColumnChange(dt, "DEVICECONTENT");
                skillabnormal = ColumnChange(dt, "SKILLABNORMAL");
                skillcontent = ColumnChange(dt, "SKILLCONTENT");
                lotabnormal = ColumnChange(dt, "LOTABNORMAL");
                lotcontent = ColumnChange(dt, "LOTCONTENT");
                workabnormal = ColumnChange(dt, "WORKABNORMAL");
                workcontent = ColumnChange(dt, "WORKCONTENT");
                rubberno = ColumnChange(dt, "RUBBERTYPE");
                rubberlotno = ColumnChange(dt, "RUBBERLOT");
                rubbernum = ColumnChange(dt, "RUBBERNUM");
                rubberrealnum = ColumnChange(dt, "RUBBERACTUAL");
                elementno = ColumnChange(dt, "ELEMENTTYPE");
                elementlotno = ColumnChange(dt, "ELEMENTLOT");
                elementnum = ColumnChange(dt, "ELEMENTNUM");
                elementrealnum = ColumnChange(dt, "ELEMENTACTUAL");
                tireno = ColumnChange(dt, "TIRETYPE");
                tirelotno = ColumnChange(dt, "TIRELOT");
                tirenum = ColumnChange(dt, "TIRENUM");
                tirerealnum = ColumnChange(dt, "TIREACTUAL");
                prono = ColumnChange(dt, "PROTYPE");
                prolotno = ColumnChange(dt, "PROLOT");
                pronum = ColumnChange(dt, "PRONUM");
                prorealnum = ColumnChange(dt, "PROACTUAL");
                remarks = ColumnChange(dt, "REMARKS");
                approvalreason = ColumnChange(dt, "APPROVALREASON");
                state = ColumnChange(dt, "STATE");
            }

        }

        /// <summary>
        /// 数据绑定
        /// </summary>
        /// <returns></returns>
        private DataTable Bind()
        {
            IDictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("mid", mid);
            return ledgerbll.GetExpInfo(dic);
        }

        /// <summary>
        /// 获取datatable对应列的数据
        /// </summary>
        /// <param name="columnname"></param>
        /// <returns></returns>
        private string ColumnChange(DataTable dt, string columnname)
        {
            return dt.Rows[0][columnname].ToString();
        }
    }
}